package com.dianping.cat.home.heavy.transform;
import com.dianping.cat.home.heavy.entity.HeavyCache;
import com.dianping.cat.home.heavy.entity.HeavyCall;
import com.dianping.cat.home.heavy.entity.HeavyReport;
import com.dianping.cat.home.heavy.entity.HeavySql;
import com.dianping.cat.home.heavy.entity.Service;
import com.dianping.cat.home.heavy.entity.Url;
import java.util.ArrayList;
import java.util.List;

public class DefaultLinker implements ILinker {
  private boolean m_deferrable;
  
  public DefaultLinker(boolean deferrable) {
/*  15 */     this.m_deferedJobs = new ArrayList();


/*  18 */     this.m_deferrable = deferrable;
  }
  private List<Runnable> m_deferedJobs;
  public void finish() {
/*  22 */     for (Runnable job : this.m_deferedJobs) {
/*  23 */       job.run();
    }
  }

  
  public boolean onHeavyCache(HeavyReport parent, HeavyCache heavyCache) {
    parent.setHeavyCache(heavyCache);
/*  30 */     return true;
  }

  
  public boolean onHeavyCall(HeavyReport parent, HeavyCall heavyCall) {
/*  35 */     parent.setHeavyCall(heavyCall);
    return true;
  }

  
  public boolean onHeavySql(HeavyReport parent, HeavySql heavySql) {
/*  41 */     parent.setHeavySql(heavySql);
/*  42 */     return true;
  }

  
  public boolean onService(final HeavySql parent, final Service service) {
/*  47 */     if (this.m_deferrable) {
/*  48 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/*  51 */               parent.addService(service);
            }
          });
    } else {
/*  55 */       parent.addService(service);
    }
    
/*  58 */     return true;
  }

  
  public boolean onService(final HeavyCall parent, final Service service) {
/*  63 */     if (this.m_deferrable) {
/*  64 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/*  67 */               parent.addService(service);
            }
          });
    } else {
/*  71 */       parent.addService(service);
    }
    
/*  74 */     return true;
  }

  
  public boolean onService(final HeavyCache parent, final Service service) {
/*  79 */     if (this.m_deferrable) {
/*  80 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/*  83 */               parent.addService(service);
            }
          });
    } else {
/*  87 */       parent.addService(service);
    }
    
/*  90 */     return true;
  }

  
  public boolean onUrl(final HeavySql parent, final Url url) {
    if (this.m_deferrable) {
/*  96 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/*  99 */               parent.addUrl(url);
            }
          });
    } else {
/* 103 */       parent.addUrl(url);
    }
    
/* 106 */     return true;
  }

  
  public boolean onUrl(final HeavyCall parent, final Url url) {
/* 111 */     if (this.m_deferrable) {
/* 112 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 115 */               parent.addUrl(url);
            }
          });
    } else {
/* 119 */       parent.addUrl(url);
    }
    
/* 122 */     return true;
  }

  
  public boolean onUrl(final HeavyCache parent, final Url url) {
/* 127 */     if (this.m_deferrable) {
/* 128 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 131 */               parent.addUrl(url);
            }
          });
    } else {
/* 135 */       parent.addUrl(url);
    }
    
/* 138 */     return true;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/heavy/transform/DefaultLinker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */